package com.moxing.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * @Description: (Swagger配置)
 */
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
    /**
     * 创建 Docket Bean（核心配置）
     * @return Docket 实例
     */
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2) // 指定使用 Swagger 2.x
                .select()                                  // 开始构建选择条件
                .apis(RequestHandlerSelectors.basePackage("com.moxing.admin.controller")) // 扫描的控制器包路径
                .paths(PathSelectors.any())              // 所有路径都生成文档
                .build();                               // 完成构建
    }

}
